<template>
  <div style="height: 100%!important;">
    <div class="sanMeetScreen container">
        <div class="title" style="height: 9%!important;">
            <div class="inner">{{ meetingName }}</div>
        </div>
        <div class="count">
            <div class="total"><span class="total-text">应参人数：</span><span class="total-num">{{ signStatObj.t1 }}</span></div>
            <div class="total"><span class="total-text">签到人数：</span><span class="total-num">{{ signStatObj.t2? signStatObj.t2.length:0 }}</span></div>
        </div>
        <div class="main" style="height: 91%!important;">
            <div class="box left" style="transition: width 1s;" :style="{'width': isShowQrcode? '' : 'calc(100% - 60px)'}">
                <div class="title">签到大屏</div>
                <div class="avatar-wrap">
                    <div class="avatar" v-for="(item, index) in signStatObj.t2" :key="index">
                        <span class="ant-avatar img ant-avatar-circle">
                        <span class="ant-avatar-string" style="transform: scale(1) translateX(-50%);">{{ item.userName ? item.userName.substring(1,3) : '' }}</span>
                        </span>
                        <span class="name">{{ item.userName }}</span>
                    </div>
                </div>
            </div>
            <div class="box right" style="transition: right 1s;" :style="{'right': isShowQrcode? '' : '-300px'}">
                <div class="title">扫码签到</div>
                <div class="switch" @click="isShowQrcode = !isShowQrcode">
                    <span :style="{'display': isShowQrcode? 'block' : 'none'}">关闭二维码 <el-icon><ArrowRight /></el-icon> </span>
                    <span :style="{'display': !isShowQrcode? 'block' : 'none'}">开启二维码 <el-icon><ArrowLeft /></el-icon> </span>
                </div>
                <div class="code">
                    <vue-qrcode :value="qrCodeValue" :size="qrCodeSize" style="width: 240px;height: 240px; object-fit: fill; text-align: center;"></vue-qrcode>
                </div>
                <div class="cover-wrap">
                    <div class="roll" id="roll-box"><ul id="data-ul-1"></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>

<script setup>
import router from "@/router";
import { meetingSignStat } from "@/api/partybuilding/MeetingReceipt";
import useAppStore from '@/store/modules/app'
const baseUrl = import.meta.env.VITE_SITE_SIGN_URL;
const { proxy } = getCurrentInstance();
const isShowQrcode = ref(false);
const appStore = useAppStore()
const signStatObj = ref({});
const meetingId = ref('');
const meetingName = ref('');
const qrCodeValue = ref("");
const qrCodeSize = 399;

onMounted(() => {
    appStore.toggleSideBarHide(true);
    document.querySelector('.navbar').remove();
    document.querySelector('.tags-view-container').remove();
    document.querySelector('.sidebar-container').remove();
    document.querySelector('.fixed-header').remove();
    document.querySelector('.fixed-top').remove();
    getQueryParams();
})

//获取传入参数值
function getQueryParams() {
  const urlParams = new URLSearchParams(window.location.search);
  console.log("urlParams=", urlParams);
  console.log("meetingId=", urlParams.get('meetingId'));
  console.log("meetingName=", urlParams.get('meetingName'));
  meetingId.value = urlParams.get('meetingId');
  meetingName.value = urlParams.get('meetingName');
  qrCodeValue.value = baseUrl+"/signLogin?meetingId="+meetingId.value;
  getList();
}

let timer = setInterval(() => {
    getList();
}, 10000);

onUnmounted(() => {
  if (timer) {
    clearInterval(timer)
  }
});


/** 查询签到统计 */
function getList() {
    let obj ={};
    obj.meetingId = meetingId.value;
    meetingSignStat(obj).then(response => {
      signStatObj.value = response.data;
    });
}

// 取消按钮
function cancel() {
  open.value = false;
  reset();
}

// 图表展示
function handleChart() {
  router.push({ path: "/work/MeetingInfo", query: { pageNum: 1 } });
}

function handleAlreadySignin(flag) {
  isAlreadySign.value = flag;
}
</script>
<style>
.app-wrapper .main-container .app-main {
    height: 100%!important;
    background-image: url(../../../assets/images/bg_all.7c98705a.png);
    background-size: 100% 100%;
}
</style>
<style lang="scss" scoped>
.sanMeetScreen.container {
    width: 100%;
    height: 100%!important;
    position: relative;
    font-size: 24px;
    text-align: center;
}
.sanMeetScreen.container .title {
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-pack: center;
    justify-content: center;
    width: 776px;
    height: 80px;
    font-size: 1.2em;
    color: #ffe1be;
    margin: 0 auto;
}
.sanMeetScreen.container>.title {
    background-image: url(../../../assets/images/bg_dapin_title.bb7babc4.png);
    background-size: 100% 100%;
}
.sanMeetScreen.container .count {
    position: absolute;
    right: 1%;
    top: 70px;
}
.sanMeetScreen.container .count .total {
    color: #ffdbc9;
    line-height: 25px;
    display: inline-block;
}
.sanMeetScreen.container .count .total-num {
    margin-right: 30px;
    font-size: 1.8em;
    margin-bottom: 10px;
}
.sanMeetScreen.container .count .total-text {
    font-size: .75em;
}
.sanMeetScreen.container .main {
    position: relative;
    width: 100%;
    height: 100%!important;
    padding-top: 100px;
    padding-bottom: 70px;
    padding-left: 50px;
}
.sanMeetScreen.container .main .box {
    height: 76%!important;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, .25);
}
.sanMeetScreen.container .main .box .title {
    width: 216px;
    height: 55px;
    line-height: 55px;
    border: 2px solid rgba(255, 200, 28, .48);
    border-radius: 0 0 20px 20px;
    box-shadow: inset 0 0 10px 10px rgba(255, 229, 61, .15);
}
.sanMeetScreen.container .main .box.left {
    position: relative;
    width: calc(100% - 360px);
    height: calc(100% - 5px)!important;
}
.sanMeetScreen.container .main .box.left:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 25px solid transparent;
    border-image: url(../../../assets/images/img_jiao.99e63f5d.png) 30 30 stretch;
}
.sanMeetScreen.container .main .box.right {
    position: absolute;
    top: 100px;
    right: 0;
    width: 300px;
    height: calc(100% - 178px)!important;
}
.sanMeetScreen.container .main .box.right:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%!important;
    border-left: 25px solid transparent;
    border-top: 25px solid transparent;
    border-bottom: 25px solid transparent;
    border-image: url(../../../assets/images/img_jiao.99e63f5d.png) 30 30 stretch;
}
.sanMeetScreen.container .main .box.right .switch {
    position: absolute;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -ms-flex-direction: column;
    flex-direction: column;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-align: center;
    align-items: center;
    left: -40px;
    top: 50%;
    width: 40px;
    height: 267px;
    font-size: .84em;
    background: rgba(0, 0, 0, .25);
    border-radius: 22px 0 0 22px;
    padding: 32px 6px;
    cursor: pointer;
    margin-top: -133.5px;
}
.sanMeetScreen.container .main .box.right .code {
    width: 240px;
    height: 240px;
    background-color: #fff;
    margin: 50px auto 20px;
}
.sanMeetScreen, .sanMeetScreen div, .sanMeetScreen li, .sanMeetScreen ul {
    box-sizing: border-box;
}
.sanMeetScreen.container .main .box.right .cover-wrap {
    position: relative;
    text-align: left;
}

.anticon {
    display: inline-block;
    color: inherit;
    font-style: normal;
    line-height: 0;
    text-align: center;
    text-transform: none;
    vertical-align: -.125em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.sanMeetScreen {
    color: #fff;
}

.sanMeetScreen.container .main .box.left .avatar-wrap {
    display: grid;
    grid-template-columns: auto auto auto auto auto auto auto auto;
    grid-template-rows: auto auto auto;
    height: 90%!important;
    padding: 30px 20px 30px;
    overflow: hidden;
}
.sanMeetScreen.container .main .box.left .avatar-wrap .avatar {
    margin-bottom: 19px;
    cursor: pointer;
}

.sanMeetScreen.container .main .box.left .avatar-wrap .avatar .img {
    display: block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    background-color: #ffb7b7;
    margin: 0 auto;
}
.ant-avatar {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: rgba(0, 0, 0, .65);
    font-size: 14px;
    font-variant: tabular-nums;
    line-height: 1.5;
    list-style: none;
    -webkit-font-feature-settings: "tnum";
    font-feature-settings: "tnum";
    position: relative;
    display: inline-block;
    overflow: hidden;
    color: #fff;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    background: #ccc;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 50%;
}
.sanMeetScreen.container .main .box.left .avatar-wrap .avatar .img .ant-avatar-string {
    color: #a4070d;
    font-size: 24px;
}
.ant-avatar-string {
    position: absolute;
    left: 50%;
    -ms-transform-origin: 0 center;
    transform-origin: 0 center;
}
.sanMeetScreen.container .main .box.left .avatar-wrap .avatar .name {
    display: block;
    margin-top: 12px;
    color: #ffdbc9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
</style>